//
//  BKRechargeRecordCell.m
//  BESTKEEP
//
//  Created by ForgetFairy on 2016/10/25.
//  Copyright © 2016年 YISHANG. All rights reserved.
//

#import "BKRechargeRecordCell.h"
#import "BKMainCommon.h"

@interface BKRechargeRecordCell()

@property (nonatomic, strong) UIImageView *ispImageView;
@property (nonatomic, strong) UILabel *chargeAmount;
@property (nonatomic, strong) UILabel *rechargeMsg;
@property (nonatomic, strong) UILabel *rechargeDate;

@end

@implementation BKRechargeRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

-(void)initUI{

    _ispImageView = [UIImageView new];
    [self addSubview:_ispImageView];
    [_ispImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(15);
        make.left.equalTo(self.mas_left).offset(ApplicationBackGauge);
        make.bottom.equalTo(self.mas_bottom).offset(-15);
        make.width.equalTo(_ispImageView.mas_height);
    }];
    
    _rechargeMsg = [UILabel new];
    _rechargeMsg.textColor = RGBACOLOR(64, 64, 64, 1);
    _rechargeMsg.font = UIFontNormal;
    [self addSubview:_rechargeMsg];
    [_rechargeMsg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(16);
        make.left.equalTo(_ispImageView.mas_right).offset(11.5);
        make.right.equalTo(self.mas_right).offset(-ApplicationBackGauge);
        make.height.mas_equalTo(14);
    }];
    
    _rechargeDate = [UILabel new];
    _rechargeDate.textColor = HexColor(0x888888);
    _rechargeDate.font = UIFontSmallest;
    [self addSubview:_rechargeDate];
    [_rechargeDate mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_ispImageView.mas_right).offset(11.5);
        make.right.equalTo(self.mas_right).offset(-ApplicationBackGauge);
        make.bottom.equalTo(self.mas_bottom).offset(-17);
        make.height.mas_equalTo(10);
    }];
    
    UIView *line = [UIView new];
    line.backgroundColor = RGBACOLOR(242, 242, 242, 1);
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_bottom).offset(-0.5);
        make.left.equalTo(self.mas_left).offset(16);
        make.height.equalTo(@.8f);
        make.right.equalTo(self.mas_right).offset(-16);
    }];
    
    _chargeAmount = [UILabel new];
    _chargeAmount.textColor = RGBACOLOR(64, 64, 64, 1);
    _chargeAmount.font = UIFontLarge;
    [self addSubview:_chargeAmount];
    [_chargeAmount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-ApplicationBackGauge);
    }];
    
}

-(void)setRecordModel:(BKPhoneCardsModel *)recordModel{

    _recordModel = recordModel;
    if ([[NSString stringWithFormat:@"%@", _recordModel.isp] isEqualToString:@"0"]) {
        _ispImageView.image = [UIImage imageNamed:@"BKPhone_liantong"];
    }else if([[NSString stringWithFormat:@"%@", _recordModel.isp] isEqualToString:@"1"]) {
        _ispImageView.image = [UIImage imageNamed:@"BKPhone_yidong"];
    }else if([[NSString stringWithFormat:@"%@", _recordModel.isp] isEqualToString:@"2"]) {
        _ispImageView.image = [UIImage imageNamed:@"BKPhone_dianxin_"];
    }
    _rechargeMsg.text = [NSString stringWithFormat:@"%@-%@", _recordModel.orderName, _recordModel.rechargePhone];
    _rechargeDate.text = [NSString stringWithFormat:@"%@", _recordModel.payTime];
    _chargeAmount.text = [NSString stringWithFormat:@"%@", _recordModel.payAmount];
}

@end
